
var achieveData = require('./achieveData')();
var GameData = require('../../module/GameData')();

cc.Class({
    extends: cc.Component,

    properties: {
        progress_bg:cc.Node,
        progress_bar:cc.Node,
        achieve_item:cc.Prefab,
        tip:cc.Node,
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        GameData.achieve_layer=this;
        this.progress_bg.width=achieveData.achieve_Data.length*achieveData.space;
        this.progress_bar.width=achieveData.own_score*achieveData.space;

        for(var a=0;a<achieveData.achieve_Data.length;a++){
            var item=cc.instantiate(this.achieve_item);
            item.getComponent("achieve_item").init(achieveData.achieve_Data[a]);
            item.x=achieveData.space*(a+1);
            item.parent=this.progress_bar;
        }
        var fun=function(){};
        cc.find("loadbg").getComponent("loadbg").show(fun)

    },

    start () {

    },
    back(){
        cc.director.loadScene("game_start");
    },
    // update (dt) {},
});
